<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>JavaScript HTML DOM - 改变CSS-改变 HTML 样式</title>
</head>

<body>
    <!-- 如需改变 HTML 元素的样式，请使用这个语法：
        document.getElementById(id).style.property=新样式 -->
    <p id="p1">Hello World!</p>
    <p id="p2">Hello World!</p>
    <script>
        document.getElementById("p2").style.color = "blue";
        document.getElementById("p2").style.fontFamily = "Arial";
        document.getElementById("p2").style.fontSize = "larger";
    </script>
    <p>以上段落通过脚本修改。</p>
</body>

</html>